﻿@model FCNS.ERP.Models.ErpSeat

@{
    ViewBag.Title = "枱号-编辑";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>
<script src="~/Scripts/Erp/food.js"></script>
<script type="text/javascript">
        $(document).ready(function () {
            $(":button").click(function () {
                if (SeatCheck($("#Id").val(), $("#Name").val()) == true)
                {
                    $("form").submit();
                }
                else
                {
                    alert($("#Name").val()+" 枱号已存在");
                }
            });

        });
</script>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    
    <div class="form-horizontal"> 
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        @Html.HiddenFor(model => model.Id)

        <div class="form-group">
            @Html.LabelFor(model => model.Enable, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                <div class="checkbox">
                    @Html.EditorFor(model => model.Enable)
                    @Html.ValidationMessageFor(model => model.Enable, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.CategorySeatId, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("CategorySeatId", ViewData["CategorySeat"] as SelectList, htmlAttributes: new { @class = "form-control" })
            </div>
        </div>


        <div class="form-group">
            @Html.LabelFor(model => model.Status, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                <select class="form-control" data-val="true" data-val-required="状态 字段是必需的。" id="Status" name="Status">
                    <option value="0">故障</option>
                    <option  value="1">空闲</option>
                </select>
                @Html.ValidationMessageFor(model => model.Status, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
            </div>
        </div>
         
        <div class="form-group">
            @Html.LabelFor(model => model.NumberOfPeople, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                    @Html.EditorFor(model => model.NumberOfPeople,  new { htmlAttributes = new { @min = "1" } })
                    @Html.ValidationMessageFor(model => model.NumberOfPeople, "", new { @class = "text-danger"  })
            </div>
        </div> 

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="button" value="保存" class="btn btn-default" />
            </div>
        </div>
    </div>
}

    <div>
        <a class="backToListImg" href="/Food/Seat">返回</a>
    </div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
